
public class recurssionMin {


	static int sum = 0;
	static int temp;
	
	static int sumArr(int[] arr, int m){
		if(m==0){
			temp = arr[0];
			sum = temp + sum;
			return sum;
		}
	
		temp = arr[m];
		sum = temp + sumArr(arr, m-1);
		return sum;
		
	}
	
	static int minFromArr(int[] arr, int m){
		
		if(m == 0){
			return arr[0];
		}
		
		if(arr[m]<minFromArr(arr, m-1)) {
			return arr[m];
		}else {
			return minFromArr(arr, m-1);
		}
		
	}
	
	
	
	public static void main(String[] args) {
		int[] arr = {2,-3,1,15,7};
		int m = arr.length - 1;
		
		//int minimum = minFromArr(arr, m);
		//System.out.println(minimum);
		System.out.println(sumArr(arr, m));
		
	}

}
